package cn.ad.server.domain.ad;

import java.io.Serializable;
import java.util.Date;

/**
 * Strategy和Geo的mapping关系。
 * 
 * @author alleywind
 *
 */
public class StrategyGeoMap implements Serializable {


	/**
	 * 
	 */
	private static final long serialVersionUID = -2635684283732436684L;
	static final String VERSION = "0";
	static final String CACHE_NAME = "strategygeomap";

	private long id;
	private long strategyId;
	private int geoType;
	private int geoId;
	private int includeMode;
	private int status;
	private Date createTime;
	private Date updateTime;

	public static String cacheKey(long id) {
		return new StringBuilder(CACHE_NAME).append(":").append(VERSION).append(":").append(id).toString();
	}

	public String toCacheKey() {
		return new StringBuilder(CACHE_NAME).append(":").append(VERSION).append(":").append(this.getId()).toString();
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getStrategyId() {
		return strategyId;
	}

	public void setStrategyId(long strategyId) {
		this.strategyId = strategyId;
	}

	public int getGeoType() {
		return geoType;
	}

	public void setGeoType(int geoType) {
		this.geoType = geoType;
	}

	public int getGeoId() {
		return geoId;
	}

	public void setGeoId(int geoId) {
		this.geoId = geoId;
	}

	public int getIncludeMode() {
		return includeMode;
	}

	public void setIncludeMode(int includeMode) {
		this.includeMode = includeMode;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public boolean equals(Object arg0) {
		if(arg0 instanceof StrategyGeoMap){			
			return this.id==((StrategyGeoMap)arg0).id;
		}else{
			return super.equals(arg0);
		}
	}
	
	public int hashCode() {
		return Long.valueOf(id).hashCode();
	}

}
